package com.sbpm.crmbpm.client.application;

import com.google.gwt.core.client.GWT;
import com.sbpm.crmbpm.client.application.dict.Dictionaries;
import com.sbpm.crmbpm.client.services.CompanyManagement;
import com.sbpm.crmbpm.client.services.CompanyManagementAsync;
import com.sbpm.crmbpm.client.services.DictionaryManagement;
import com.sbpm.crmbpm.client.services.DictionaryManagementAsync;
import com.sbpm.crmbpm.client.util.SimpleAsyncCallback;
import com.sbpm.crmbpm.shared.data.dict.City;

import java.util.List;

public class ApplicationContextLoader
{
    private static final DictionaryManagementAsync dictionaryManagement = GWT.create( DictionaryManagement.class );

    public static void load( final SimpleAsyncCallback callback )
    {
        dictionaryManagement.getCitiesWithCountries( new SimpleAsyncCallback< List< City > >()
        {
            @Override
            public void onSuccess( List< City > result )
            {
                Dictionaries.loadCitiesAndCountries( result );
                callback.onSuccess( null );
            }
        } );
    }
}
